package com.Cychat.AI.tools;

import com.Cychat.commons.entity.ResultMessage;
import com.Cychat.commons.entity.vo.DoctorVo;
import com.Cychat.commons.entity.pojo.Hospital;
import com.Cychat.commons.feign.DoctorFeignService;
import lombok.Data;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Auther: 谢宝辉  <br/>
 * Date: 2025/11/6:11:43  <br/>
 * Description: 医生工具类
 */
@Data
@Component
public class DoctorTools {
    private Long userId;

    @Autowired
    private DoctorFeignService doctorFeignService;

    @Tool(description = "根据症状描述，给出能够解决该症状的医生信息，并包含其科室信息和所在的医院信息")
    public ResultMessage<List<DoctorVo>> getAllDoctors(@ToolParam(description = "症状描述") String symptom){
        ResultMessage<List<DoctorVo>> result = doctorFeignService.getAllDoctors();
        if(result.getData() == null){
            return ResultMessage.error("暂无医生信息");
        }
        return result; // 直接返回封装后的结果
    }

    @Tool(description = "根据症状描述，给出能够解决该症状的完整的医院名称")
    public ResultMessage<List<Hospital>> getAllHospital(@ToolParam(description = "症状描述") String symptom){
        ResultMessage<List<Hospital>> result = doctorFeignService.getAllHospital();
        if(result.getData() == null){
            return ResultMessage.error("暂无医院信息");
        }
        return result; // 直接返回封装后的结果
    }
}
